<div class="row"> <h3 class="page-header">实验室管理</h3></div>
<div class="row">
    <div class="panel panel-default">
        <div class="panel-body">
            <label><a class="btn btn-primary addText">添加</a></label>
            <div class="table-responsive">
                <table class="table table-striped table-bordered table-hover">
                    <thead>
                        <tr>
                            <th width="60">序号</th>
                            <th>名称</th>
                            <th>排序</th>
                            <th>状态</th>
                            <th width="120">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                     <empty name="list">
                            <tr><td colspan="5" align="center">暂无信息</td></tr>
                        </empty>
                        <volist name="list" id="list">
                            <tr>
                                <td>{$i}</td>
                                <td>{$list.name}</td>
                                <td>{$list.sort}</td>
                                 <td><button class='btn <eq name="list.status" value="1">btn-primary<else />btn-default</eq> btn-sm setStatus' type="button" data-url='{:U("JsBaseInfo/sysxxSetStatus?id=".$list["id"])}' data-status="{$list.status}"><eq name="list.status" value='1'>启用<else />禁用</eq></button></td>
                                <td>
                                    <button class="btn-sm btn btn-default editText" data-id='{$list.id}' >修改</button>
                                    <button data-url='{:U("JsBaseInfo/sysxxDel?id=".$list["id"])}' class="btn-sm btn btn-default delBtn" type="button">删除</button>
                                </td>
                            </tr>
                        </volist>
                    </tbody>
                </table>
            </div>
            {$page}
        </div>
    </div>
</div>
<div id="myModal" class="modal fade in" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
	        <form action="{:U('JsBaseInfo/sysxxAdd')}" id="myform" class="form-horizontal" data-callback="_form_defult_callback">
	            <div class="modal-header">
	                <button data-dismiss="modal" class="close" type="button">×</button>
	                <h4 class="modal-title">实验室管理</h4>
	            </div>
	            <div class="modal-body">
				    <div class="form-group">
				        <label class="col-sm-3 control-label">名称：<span class="c-red">*</span></label>
				        <div class="col-sm-6 input-group">
                            <input class="form-control required" name="name">
                        </div>
				    </div>
				    <div class="form-group">
                    <label class="col-sm-3 control-label">排序：</label>
                   <div class="col-sm-4 input-group">
                        <input class="form-control digits" name="set_sort" value="100">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="col-sm-3 control-label">状态：</label>
                    <div class="col-sm-4 input-group">
                        <label class="radio-inline">
                            <input type="radio" value="1" name="set_status" checked>启用
                        </label>
                        <label class="radio-inline">
                            <input type="radio" value="0" name="set_status">禁用<BR>
                        </label>
                    </div>
                </div>
                </div>
	            <div class="modal-footer">
	                <button data-dismiss="modal" class=" btn btn-default" type="button">关闭</button>
	                <button class="btn btn-primary" type="submit">保存</button>
	            </div>
                <input type="hidden" name="id" />
            </form>
        </div>
    </div>
</div>
<script>
$(function(){
	$('.addText').click(function(){
		$('#myform')[0].reset();
		$('#myModal').modal('show');
	});
	$('.editText').click(function(){
		$('#myform')[0].reset();
		var id = $(this).data('id'); waiting();
		$.get('{:U("JsBaseInfo/sysxxEdit")}', {id: id}, function(data){
			complete();
			 if(data.status == 1){
                var _get_info = data.info;
            $('#myform input[name="id"]').val(_get_info.id);
            $('#myform input[name="name"]').val(_get_info.name);
            $('#myform input[name="set_sort"]').val(_get_info.sort);          
            $("#myform :radio[name=set_status][value='"+_get_info.status+"']").attr("checked",true)
            $('#myform').attr('action', '{:U("JsBaseInfo/sysxxEdit")}');
            $('#myModal').modal('show');
        }else{
            showInfo(data.info);
            setTimeout('_form_defult_callback()', 1600);

        }
     });
	});
})
</script>